<template>
  <div id="aCoursesList" class="bg-fa of">
    <y-header></y-header>
    <!-- 讲师介绍 开始 -->
    <section class="container">
      <div class="comm-title" style="marginTop:50px">
        <h2 class="fl tac">
          <span class="c-333"><a class="c-333" href="/teacher" style="fontSize:30px">讲师介绍</a></span>
        </h2>
      </div>
      <el-divider></el-divider>
      <div class="t-infor-wrap">
        <!-- 讲师基本信息 -->
        <section class="fl t-infor-box c-desc-content">
          <div class="mt20 ml20">
            <section class="t-infor-pic" >
              <img :src="teacher.avatar" >
            </section>
            <div class="teachermsg">
            <h3 class="hLh30">
              <span class="fsize24 c-333">{{teacher.name}}&nbsp;{{teacher.level===1?'高级讲师':'首席讲师'}}</span>
            </h3>
            <section class="mt10">
              <span class="t-tag-bg">{{teacher.career}}</span>
            </section>
            <section class="t-infor-txt">
              <p class="mt20" html="teacher.intro">{{teacher.intro}}</p>
            </section>
            <div class="clear"></div>
          </div>
          </div>
        </section>
        <div class="clear"></div>
      </div>
      <section class="mt30">
        <div class="coursemsg">
          <div class="comm-title all-teacher-title c-course-content">
            <h2 class="fl tac">
              <span class="c-333" style="fontSize:30px">主讲课程</span>
            </h2>
            
          </div>
          <el-divider></el-divider>
          <!-- /无数据提示 开始-->
          <section class="no-data-wrap" v-if="eduCourseList.length==0" style="marginBottom:50px">
            <el-empty description="没有相关数据，小编正在努力整理中..."></el-empty>
          </section>
          <!-- /无数据提示 结束-->

          <article class="comm-course-list" style="marginBottom:50px">
            <!-- <ul class="of">
              <li v-for="course in eduCourseList" :key="course.id">
                <div class="cc-l-wrap">
                  <section class="course-img">
                    <img :src="course.cover" class="img-responsive" >
                    <div class="cc-mask">
                      <a :href="'/course/'+course.id" title="开始学习" target="_self" class="comm-btn c-btn-1">开始学习</a>
                    </div>
                  </section>
                  <h3 class="hLh30 txtOf mt10">
                    <a href="#" :title="course.title" target="_self" class="course-title fsize18 c-333">{{course.title}}</a>
                  </h3>
                </div>
              </li>

            </ul> -->
             <div class="courselist_page">
            <div class="course_content">
      <ul class="clearfix">
        <li v-for="(item, index) in eduCourseList" :key="index">
          <nuxt-link target="_blank" :to="{name: 'view-id', params: {id: item.id}}" class="course_info">
            <div class="img_box">
              <img class="course_img" :src="item.courseLogo" alt="">
            </div>
            <div class="item_top">
            <p>{{item.courseName}}</p>
            <p>{{teacher.name}}</p>
            </div>
            <div class="item_bottom">
            <span class="price_box" v-if="item.isFree">免费</span>
            <span class="price_box" v-else>￥{{item.courseOriginal.toFixed(2)}}<span class="font_12 padl_10" v-if="openVip && item.courseOriginal !== item.courseDiscount">SVIP:{{item.courseDiscount ? '￥' + item.courseDiscount.toFixed(2) : '免费'}}</span></span>
             <nuxt-link target="_blank" :to="{name: 'view-id', params: {id: item.id}}" ><el-button type="success" style="marginRight:10px;marginTop:10px">开始学习</el-button></nuxt-link>
            </div>
          </nuxt-link>
        </li>
      </ul>
      <d-page v-if="totalPage > 1" :page="pageObj" @btnClick="getPage"></d-page>
    </div>
             </div>
            <div class="clear"></div>
          </article>
        </div>
      </section>
    </section>
    <!-- /讲师介绍 结束 -->
    <y-footer></y-footer>
  </div>
</template>
<script>

  import YHeader from '~/components/common/Header'
  import YFooter from '~/components/common/Footer'
 export default {
    data() {
      return{
        teacher:
          {
            avatar:"https://cllearning.oss-cn-shenzhen.aliyuncs.com/course/f07c653f5bbb433b9d002e0c45e47f7d.jpeg",
            name:"张杰",
            level:1,
            career:"北京师范大学教授",
            intro:"<p>北京师范大学法学院副敕授、清华大学法 学博士。自2004年至今已有9年 的司法考试培训经验。长期从事司法考试辅导，深知命题规律。了解解题技巧。内容把握准确,报课重点明确，层次分明。调理清晰，将法条法理与案例有机融合。强调综合。深入浅出。</p>"
          },
        eduCourseList:[
          {
              courseDiscount:1,
              courseLogo:"https://cllearning.oss-cn-shenzhen.aliyuncs.com/course/8245a3f7a09642b9a9ec6a2ea525a029.png",
              courseName:"JAVA",
              courseOriginal:5,
              id:"1495302197351624706",
              isFree:1,
              teachername:"张杰"

            },{
              courseDiscount:0,
              courseLogo:"https://cllearning.oss-cn-shenzhen.aliyuncs.com/course/8245a3f7a09642b9a9ec6a2ea525a029.png",
              courseName:"Python",
              courseOriginal:0,
              id:"1492513175231270916",
              isFree:1,
              teachername:"张杰"
            },{
              courseDiscount:0,
              courseLogo:"https://cllearning.oss-cn-shenzhen.aliyuncs.com/course/8245a3f7a09642b9a9ec6a2ea525a029.png",
              courseName:"PHP",
              courseOriginal:0,
              id:"1492513175231270917",
              isFree:1,
              teachername:"张杰"
            },{
              courseDiscount:0,
              courseLogo:"https://cllearning.oss-cn-shenzhen.aliyuncs.com/course/8245a3f7a09642b9a9ec6a2ea525a029.png",
              courseName:"JavaScript",
              courseOriginal:0,
              id:"1492513175231270918",
              isFree:1,
              teachername:"张杰"
            }
        ],
        totalPage:10
      }
    },
     components: {
    YHeader,
    YFooter,
  },

 }
//   import teacherApi from "@/api/teacher"
//   export default {
//     asyncData({params,error}) {
//       return teacherApi.selectByTeacherId(params.id).then( response => {
//         return {
//           teacher: response.data.data.eduTeacher,
//           eduCourseList: response.data.data.eduCourseList
//         }

//       })
//     },

//   };
</script>
<style lang="scss" rel="stylesheet/scss">
.item_top{
  display: flex;
  justify-content: space-between;
}
.item_bottom{
  display: flex;
  justify-content: flex-end;
}
 .container{
    display: flex;
    flex-direction: column;
    
  }
  .ml20{
    display: flex;
  }
  .t-infor-pic{
    margin:0 30px 0 0;
    background:#fff;
    border:1px solid #f0f0f0;
    box-shadow:5px 5px 0 rgba(0,0,0,.04);
    overflow:hidden;
    width: 500px;

  }
  .t-infor-pic img{
    margin:20px auto;
    width:90%;
    display:block
    }
  .fsize24{
    font-size: 26px;
  }
  .t-tag-bg{
    background:#d5d4d485;
    display:inline-block;
    padding:10px 15px;
    overflow:hidden;
    font-size:14px;
    color:#888;
    border-radius: 5px;
    margin: 10px 0px;
  }
  .t-infor-txt{
    margin:20px 10px 0;
    line-height:200%;
    font-size:14px;
    color:#777
    }
    .t-infor-txt p{
      text-indent:24px;
      text-align:justify
      }
   .coursemsg{
    display: flex;
    flex-direction: column;
    margin-top: 30px;
   }
.courselist_page {
  .course_content {
    background: rgb(245, 245, 245);
    padding: 30px 0 10px 0;
    ul p{
      font-size: 21px;
      margin-top: 10px;
      color:green;
      font-weight: bold;
    }
    ul {
      width: 1200px;
      margin: 0 auto;
    }
    li {
      float: left;
      border-radius: 6px;
      background: #fff;
      margin: 0px 20px 20px 0px;
      &:nth-child(4n) {
        margin-right: 0px;
      }
    }
  }
  .course_info {
    display: block;
    width: 285px;
    height: 240px;
    border-radius: 6px;
    position: relative;
    &:hover {
      text-decoration: none;
      color: #000;
      box-shadow: 0px 3px 18px rgba(0, 0, 0, 0.2);
      transform: translateY(-2px);
      transition: all .3s;
    }
    .img_box {
      position: relative;
      width: 285px;
      height: 140px;
      .qizi {
        background: url(../../assets/image/activity/qizi.png) no-repeat center;
        position: absolute;
        top: 0;
        left: 10px;
        width: 46px;
        height: 43px;
        padding-top: 3px;
        color: #fff;
        font-size: 14px;
        text-align: center;
      }
      .course_img {
        width: 285px;
        height: 140px;
        border-radius: 6px 6px 0 0;
      }
    }
    p {
      font-size: 16px;
      margin-top: 5px;
      padding: 0 10px;
      word-break: break-all;
    }
    .price_box {
      font-size: 18px;
      position: absolute;
      bottom: 25px;
      
      left: 10px;
      font-weight: bold;
      color: orange;
    }
  }
}
</style>

